<%@ page contentType="text/html;charset=UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<sys:header title="日志查询" htmlClass="scroll"></sys:header>
<div style="margin:10px;">
	<form:form id="searchForm" action="${ctx}/sys/log/list" method="post" class="breadcrumb form-inline">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="form-group">
			<label class="control-label">操作菜单：</label>
			<input id="title" name="title" type="text" maxlength="50" class="input-small" value="${log.title}"/>
		</div>
		<div class="form-group">
			<label class="control-label">操作用户：</label>
			<input id="userName" name="createBy.userName" type="text" maxlength="50" class="input-small" value="${log.createBy.userName}"/>
		</div>
		<div class="form-group">
			<label class="control-label">访问地址：</label>
			<input id="requestUri" name="requestUri" type="text" maxlength="50" class="input-small" value="${log.requestUri}"/>
		</div>
		<div class="form-group">
			<label class="control-label">使用设备：</label>
			<input id="userAgent" name="userAgent" type="text" maxlength="50" class="input-small" value="${log.userAgent}"/>
		</div>
		<div class="clearfix"></div>
		<div class="form-group">
			<label class="control-label">操作者IP：</label>
			<input id="remoteAddr" name="remoteAddr" type="text" maxlength="50" class="input-small" value="${log.remoteAddr}"/>
		</div>
		<div class="form-group">
			<label class="control-label">日期范围：</label>
			<input id="beginDate" name="beginDate" type="text" readonly="readonly" maxlength="20" class="width-95 Wdate"
				value="${fns:formatDate(log.beginDate, 'yyyy-MM-dd')}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			<label>&nbsp;--&nbsp;&nbsp;</label>
			<input id="endDate" name="endDate" type="text" readonly="readonly" maxlength="20" class="width-95 Wdate"
				value="${fns:formatDate(log.endDate, 'yyyy-MM-dd')}" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			&nbsp;
			<!-- <select onchange="quickSelectDate(this.value, 'beginDate', 'endDate');" style="width:75px;margin-top:-3px">
				<option value="0"></option><option value="1">今日</option><option value="2">本周</option>
				<option value="3">本月</option><option value="4">本季度</option><option value="5">上月</option>
			</select> -->
			<div class="radio-list2 input-inline">
				<span><input id="quick1" name="quick" onclick="quickSelectDate(this.value, 'beginDate', 'endDate');" type="radio" value="1"/><label for="quick1">今日</label></span>
				<span><input id="quick2" name="quick" onclick="quickSelectDate(this.value, 'beginDate', 'endDate');" type="radio" value="2"/><label for="quick2">本周</label></span>
				<span><input id="quick3" name="quick" onclick="quickSelectDate(this.value, 'beginDate', 'endDate');" type="radio" value="3"/><label for="quick3">本月</label></span>
				<!-- <span><input id="quick4" name="quick" onclick="quickSelectDate(this.value, 'beginDate', 'endDate');" type="radio" value="4"/><label for="quick4">本季度</label></span>
				<span><input id="quick5" name="quick" onclick="quickSelectDate(this.value, 'beginDate', 'endDate');" type="radio" value="5"/><label for="quick5">上月</label></span> -->
			</div>
		</div>
		<div class="form-group">
			&nbsp;<label for="exception"><input id="exception" name="exception" type="checkbox"${log.exception eq '1'?' checked':''} value="1"/>只查询异常信息</label>
			&nbsp;&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary btn-sm" type="submit" value="查询"/>&nbsp;&nbsp;
		</div>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr>
			<th>操作菜单</th>
			<th>操作用户</th>
			<th>访问地址</th>
			<th>使用设备</th>
			<th>操作者IP</th>
			<th>操作时间</th>
		</tr></thead>
		<tbody><%request.setAttribute("strEnter", "\n");request.setAttribute("strTab", "\t");%>
		<c:forEach items="${page.list}" var="log">
			<tr>
				<td>${log.title}</td>
				<td title="${log.createBy.userCode}">${log.createBy.userName}</td>
				<td title="${log.method}: ${log.serverAddr}${log.requestUri}${not empty log.params ? '?' : ''}${fns:escapeHtml(log.params)}"
					style="cursor:pointer;"><strong>${log.requestUri}</strong></td>
				<td title="${log.userAgent}">${log.deviceName} / ${log.browserName}</td>
				<td>${log.remoteAddr}</td>
				<td><fmt:formatDate value="${log.createDate}" type="both"/></td>
			</tr>
			<c:if test="${not empty log.exception}"><tr>
				<td colspan="6">
					<div class="exText" style="overflow:auto;max-width:800px;max-height:400px;">
						${fn:replace(fn:replace(fns:escapeHtml(log.exception), strEnter, '<br/>'), strTab, '&nbsp; &nbsp; ')}
					</div>
				</td>
			</tr></c:if>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</div>
<sys:footer></sys:footer>
<script type="text/javascript">
	$(window).resize(function(){
		var height = $(window).height() / 2,
			width = $(window).width() - 30;
		$('.exText').css({'max-height': height < 300 ? 300 : height,
				'max-width': width < 500 ? 500 : width});
	}).resize();
	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
    	return false;
    }
</script>